﻿$path = Get-Location;
$path = $path.ToString() + "/";
$path = $path.Replace("\", "/");

function ReplaceFileContent($fileName, $oldContent, $newContent) {
	$path = $path.Replace("\", "/");
	$filePath = $path + $fileName;
	$content = Get-Content $filePath -Raw -Encoding UTF8;
	$content = $content.Replace($oldContent, $newContent);

	Set-Content -Path $filePath -Value $content -Encoding UTF8;
}

ReplaceFileContent "coreScript.ps1" '$coreBasePath = "";' ('$coreBasePath = "' + $path + '";');
ReplaceFileContent "loader.js" 'const coreBasePath = "";' ('const coreBasePath = "' + $path + '";');
ReplaceFileContent "build.ps1" '$buildBasePath = "";' ('$buildBasePath = "' + $path + '";');

Write-Output "脚本初始化完成";
Start-Sleep -Seconds 3;